import * as CryptoJS from "crypto-js";

export default (word: string): string => {
  const AES_KEY = "7CC408B24462ABD1";
  const AES_IV = "HBJNRU56MDk4NzK6";
  const key = CryptoJS.enc.Utf8.parse(AES_KEY);
  const iv = CryptoJS.enc.Utf8.parse(AES_IV);
  const src = CryptoJS.enc.Utf8.parse(word);
  var encrypted = CryptoJS.AES.encrypt(src, key, {
    iv: iv,
    mode: CryptoJS.mode.ECB,
    padding: CryptoJS.pad.Pkcs7,
  });
  return CryptoJS.enc.Base64.stringify(encrypted.ciphertext);
};
